extends Control


# Declare member variables here. Examples:
# var a = 2
# var b = "text"

var lang_arr = GameManager.translations

export (NodePath) var dropdown_path
onready var lang_dropdown = get_node(dropdown_path)


# Called when the node enters the scene tree for the first time.
func _ready():
	siftThroughLangs()
	pass

func siftThroughLangs():
	for item in lang_arr:
		lang_dropdown.add_item(item)
	lang_dropdown.select(1)
	
	# Make English default and at the top of the list

func _on_language_selected(index:int):

	match(lang_arr[index]):
		"en":
			TranslationServer.set_locale("en")
			GameManager.isArabic = false;
			print(lang_arr[index])
		"ar":
			TranslationServer.set_locale("ar")
			GameManager.isArabic = true;
			print(lang_arr[index])
		"pl":
			TranslationServer.set_locale("pl")
			GameManager.isArabic = false;
			print(lang_arr[index])
		
